﻿using System;
using System.Windows;
using Csla.Xaml;
using Accounting.Library;

namespace csla4Skeleton.UI.SL.NghiepVu.MuaSanPham.MSP_MuaDichVu
{
    public partial class MSP_MuaDichVu_ListViewModel : ViewModel<MSP_MuaDichVuList>
    {
        
        public MSP_MuaDichVu_ListViewModel(string mode)
        {
            BeginRefresh("GetMSP_MuaDichVuList", mode);

        }

        public void GetMSP_MuaDichVu_ListViewModel(string mode)
        {
            BeginRefresh("GetMSP_MuaDichVuList", mode);
        }

        protected override void OnRefreshed()
        {
            base.OnRefreshed();
           
        }
        public static  DependencyProperty SelectedItemProperty =
          DependencyProperty.Register("SelectedItem", typeof(MSP_MuaDichVuInfo), typeof(MSP_MuaDichVu_ListViewModel), null);
        public MSP_MuaDichVuInfo SelectedItem
        {
            get { return (MSP_MuaDichVuInfo)GetValue(SelectedItemProperty); }
            set { SetValue(SelectedItemProperty, value); }
        }

        public static DependencyProperty SelectedChonItemProperty =
          DependencyProperty.Register("SelectedChonItem", typeof(Chon), typeof(MSP_MuaDichVu_ListViewModel), null);
        public Chon SelectedChonItem
        {
            get { return (Chon)GetValue(SelectedChonItemProperty); }
            set { SetValue(SelectedChonItemProperty, value); }
        }
        public class Chon
        {
            public bool CheckChonHangHoa;
        }
        public void DeleteMSP_MuaDichVu(object sender, ExecuteEventArgs e)
        {
            if (e.MethodParameter != null)
            {
                //cast OrderID parameter
                int Khoa = Int16.Parse(e.MethodParameter.ToString());
                this.IsBusy = true;
                Accounting.Library.MSP_MuaDichVu.DeleteMSP_MuaDichVu(Khoa, (o, ex) =>
                {
                    BeginRefresh("GetMSP_MuaDichVuList", BusinessConfiguration.Configuration.GridViewFetchMode);
                });
                this.IsBusy = false;
            }
        }	
    }
}
